import {
    legacy_createStore,
    applyMiddleware
} from "redux"

import thunk from "redux-thunk"
import logger from "redux-logger"

import {ALLACTIONS,ALLSTATE,SETLISTTYPE} from "../type/store.d"

const storestate={
    list:[]
}

const reduxs=(state: ALLSTATE=storestate,{type,payload}:ALLACTIONS)=>{
    switch(type){
        case SETLISTTYPE:
            state.list=payload
            return {...state}
        default :
            return state
    }

    
}

const store=legacy_createStore(reduxs,applyMiddleware(thunk,logger))

export default store